package models

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Phone    string `gorm:"type:char(11);not null; commit:'手机号码'"`
	Password string `gorm:"type:char(32);not null; commit:'密码'"`
	Status   int64  `gorm:"type:int;default:1;not null; commit:'用户状态: 1-正常,2-冻结'"`
}
type RealName struct {
	gorm.Model
	UserId   int    `gorm:"type:int;not null; commit:'用户Id'"`
	IdCard   string `gorm:"type:char(18);not null; commit:'身份证'"`
	RealName string `gorm:"type:varchar(50);not null; commit:'身份证'"`
}

func (u *User) UserList() error {
	return DB.Debug().Where("id=?", u.ID).Find(&u).Error
}
func (r *RealName) RealNameAdd() error {
	return DB.Debug().Create(&r).Error
}
func (r *RealName) RealNameList() error {
	return DB.Debug().Where("user_id=?", r.UserId).Find(&r).Error
}
